﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PefStudio.Windows
{
    [Export(MainViewMenu.Contract, typeof(IMenuItem))]
    sealed class MainViewMenuPropertiesWindow : AbstractMenuItem
    {
        public MainViewMenuPropertiesWindow()
        {
            ID = "PropertiesWindow";
            Text = "Properties Window";
            ShortcutKeys = Keys.Control | Keys.W;
        }

        protected override void OnClick(EventArgs e)
        {
            var pad = (PropertyPad)MainWindow.FindPad(typeof(PropertyPad));
            if (pad != null)
                pad.Activate();
            else
            {
                var propertyPad = MainWindow.CompositionContainer.GetExportedValue<AbstractPad>(PropertyPad.Contract);
                MainWindow.ShowPad(propertyPad);
            }
        }
    }
}
